﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BLL;
using Function;
using Model;

namespace UI.AjxaFiles
{
    /// <summary>
    /// AddBankInfo 的摘要说明
    /// </summary>
    public class AddBankInfo : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            meseege msg = new meseege();

            string bankTypeCode = context.Request.QueryString["bankTypeCode"] ?? "";
            string bankCode = context.Request.QueryString["bankCode"] ?? "";
            string bankUserName = context.Request.QueryString["bankUserName"] ?? "";

            ST_InvestorBankAccount model = new ST_InvestorBankAccount();
            model.InvestorID = Method.CurrentUserID;
            model.BankID = bankTypeCode.Trim().ToInt32();
            model.BankCode = bankCode;
            model.BankCardOwner = bankUserName;
            model.IsDefault = 2;

            int rowid= new ST_InvestorBankAccountBLL().Add(model);
            if (rowid > 0)
            {

                msg.ok = true;
                msg.message = "银行卡信息添加成功";
            }
            else
            {
                msg.ok = false;
                msg.message = "银行卡信息添加失败";
            }
            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(msg));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}